package com.lazi.june.admin.controller;

import com.lazi.june.web.version.ApiVersion;
import com.lazi.june.web.encrypt.ApiEncrypt;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * desc: 版本测试
 *
 * @author huliqian
 * @since 2025/9/11
 */
@RestController
@RequestMapping("/version")
public class TestController {

    @GetMapping("/info")
    @ApiVersion
    public String getInfoV1() {
        return "v1.0.0";
    }

    @GetMapping("/info")
    @ApiVersion("v2.0.0")
    public String getInfoV2() {
        return "v2.0.0";
    }

    @GetMapping("/info")
    @ApiVersion("v4.0.0")
    public String getInfoV4() {
        return "v4.0.0 logic";
    }

    @GetMapping("/profile")
    public String getProfile() {
        return "profile logic";
    }

    @GetMapping("/secure/{id}")
    @ApiEncrypt(response = true)
    @ApiVersion("v2.0.0")
    public String secureEcho(@PathVariable("id") Long id) {
        // 示例：命中 v2+ 的接口，响应将被加密返回
        return "echo-" + id;
    }

}
